<template>
  <div style="line-height: 60px; display: flex">
    <!--  导航栏收拉按钮  -->
    <div style="flex: 1;">
      <span :class="collapseBtnClass" style="cursor: pointer; font-size: 18px" @click="collapse"></span>

      <!--  面包屑导航  -->
      <el-breadcrumb separator="/" style="display: inline-block; margin-left: 50px; margin-bottom: -2px">
        <el-breadcrumb-item><i class="el-icon-s-promotion"></i></el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>{{ this.$route.meta.title }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <!--  个人资料栏  -->
    <el-dropdown style="width: 180px; cursor: pointer">
      <div style="display: inline-block">
        <img :src="user.avatarUrl" alt=""
             style="width: 30px; border-radius: 50%; position: relative; top: 10px; right: 10px">
        <span>{{ user.nickname }}<i class="el-icon-arrow-down" style="margin-left: 8px"></i></span>
      </div>
      <el-dropdown-menu slot="dropdown" style="width: 100px; text-align: center">
        <el-dropdown-item>
          <router-link style="text-decoration: none" to="/person">个人信息</router-link>
        </el-dropdown-item>
        <el-dropdown-item style="font-size: 14px; padding: 5px 0">
          <span style="text-decoration: none" @click="logout">退出</span>
        </el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>
</template>

<script>
export default {
  name: "Header",
  props: {
    collapseBtnClass: String,
    collapse: {}
  },
  computed: {

  },
  data() {
    return {
      lists: [],
      user: localStorage.getItem("user") ? JSON.parse(localStorage.getItem("user")) : {}
    }
  },
  methods: {
    logout() {
      this.$router.push("/login")
      localStorage.removeItem("user")
      this.$message.success("退出成功！")
    }
  }
}
</script>

<style scoped>

</style>